Mac Dude

1596 Reputation

17 Badges

14 years, 325 days

MaplePrimes Activity


These are questions asked by Mac Dude

I have an expression Vector (result from a lengthy calculation) like the following:

It is obvious by inspection that a minimized for of this expression looks like this:

Proof:

But for the heck of it I can't get Maple to find that result by itself.

My attempts are in this worksheet: Maple_example.mw

TIA,

Mac Dude.

I am a long-time user of Joe Riel's maplev mode in emacs. Upgraded emacs to version 30.2 and now it does not work anymore because of difficulties with something called abbrevlist. This is on MacOS. I am already on the last version of maplev.

Anyone have an idea what is going on and what to do? Somehow for me referencing a username no longer is possible (I get a blocking box with a spinner upon entering the at sign) so I can't create a notification for Joe.

TIA,

Mac Dude.

I am adding 'specificheat' as a property to the Element database in Maple.

In my .mapleinit I have added the property so it is permanent

I have a Package that loads the values in from a table using

  ScientificConstants:-ModifyElement(parse(elemt),specificheat=[value=data[i,4]*1000,units='J/kg/K']);

which runs in a loop for all elements I have values for. This all works.

My issue: GetUnit() returns a unit of m^2/(s^2*K). While this is not wrong, I want it to stay J/(kg*K), which is much more suitable for my work (and, besides, is the SI unit for specific heat). I can use convert to fix it on a case-by-case basis, but that is decidedly clumsy.

Is there a way to do that?

This is in Maple 2015. I have access to Maple 2023 as well, but not where I am right now. I really need this to work on all of them.

TIA,

M.D.

The title is the question. I am fairly certain that Maple in itself (up to 2023) does not have this. There is of course Statistics:-Histogram, but that is a 1-D histogram only.

Given 2 Vectors of floats, say, xvec[n] and yvec[n]. The idea would be to divide up a 2-D grid into "pixels" that accumulate a count when (xvec[i],yvec[i]) falls into the range for a pixel (xrange,yrange). Plotting each of these pixels as rectangular column creates the histogram.

I could of course program one myself, but as I am lazy and this seems like a common kind of plot (at least in statistics and in physics), someone may well have done such a thing. DDG search did not find anything, at least not wrt. Maple.

Here is an example plot close to what I am thinking of (random plot pulled off the web). The color scheme of the plot is not what I am after (although it does look nice).

Lego plot of a 600MeV/A Si track. Empty pixels (i.e. TOT count = 0) are ...

 
Thanks in advance,
Mac Dude


I recently got access to a 12-core Intel MacPro with 64 GB main memory. This motivated me to try parallel programming again, even though in prior years I have never been successfull. The project I am trying to do is particle tracking through a circular accelerator, an embarassingly parallel problem in the sense that you can track n particles in parallel through your machine for many turns and then gather up the results for analysis. The function describing the tracking is a 6-component polynomial function acting on 6-vectors and yielding a 6-Vector as a result. Each accelerator component (magnet, drift section, rf, ...) is described by such a function. I am simplifying this a bit here, but in the problem at hand this is what I am doing. The point is that each particle gets treated independently from the others, hence parallelization should be trivial.

Using an existing package (Lattice, which I published with Maple) as framework I set this up such that the tracking proc for n turns of one particle in the accelerator is a member of a module. This module is in the body of a proc and gets returned when the proc is called, essentially instantiating the tracking object and assigning it to a Vector with as many elements as I have particles to track. The tracking function returns a 6-Vector with the coordinates after all turns are complete. 
A separate proc does the instantiation of all tracking objects, gives each one its particle number (from a Beam object it is being given) and sends it off using Threads:-Create. It then waits until every task is done (using Threads:-Wait) and assembles the result in another Beam object which it returns. Please refer to the enclosed Maple worksheet for how it is done.

This actually all appears to work. MacOS is 15.7.2 (Sequoia); Maple is 2023.2. The results are identical both parallel and serial.

The "interesting" result however, is that usage of the available CPU cores saturates at about 4. In the graph shown below, the green line shows the CPU usage of the mserver process, and it saturates between 400 & 500%, actually going down to 360% as more particles get added. 100% is one core, so I am never getting more than about 4 cores to work for me. Correspondingly, the no. of seconds per particle goes up from about 3 s (particle 1 to 4) up to about 15 s/particle, settling at about 10 s/particle as 12 particles are approached. Below is a graph against no. of particles (n) of running time (red), CPU time (dark blue), CPU usage (yellow) and # or mkernel threads (green). 

Bottom line: I am only getting 4 cores out of the 12. Process limits of MacOS (ulimit -a) do not indicate any limit that would cause this (and I have had build jobs that would merrily use all 12 cores).

Is there a limit in Maple that prevents using all available cores? Am I doing something inefficient that could cause this?? This is the first time I actually got parallel operations in Maple to work, so I am happy about that, but my happiness is tempered by not getting it to work at the level I was aiming for. I did google around a bit and found some prior conversations on MP (mostly involving @acer and @Carl Love) about parallel threads which indicated that (a) environment variable OMP_NUM_THREADS should be set and (b) that numcpus can only be set at the very beginning of a Maple session (which I interpret as "right after firing up Maple"). Did both (and verified the settings were in) but no change in behaviour of this code; I only get four cpu cores to work.

Thanks,

Mac Dude

Parallel_tracking_attempt.mw

Edit: Added graph, fixed up graph.

1 2 3 4 5 6 7 Last Page 1 of 24